#include "stdafx.h"
#define BOOST_TEST_MODULE test_bmock_argument 
#include <boost/test/auto_unit_test.hpp>
#include <sstream>
#include "detail/bmock_in_out_ptr_arg_val.hpp"
#include "detail/bmock_in_out_raw_mem_ptr.hpp"
#include "detail/bmock_expand_arg.hpp"
#include "bmock_in_out_raw_mem.hpp"

namespace bmock {
	static const int                       val1   = 127;
	static const int                       val2   = 526;
	static const size_t                    LEN1   = sizeof(val1);
#define VAL3                           769

	static std::string test_func(int* x) {
		return BOOST_PP_STRINGIZE(__BMOCK_EXPAND_ARG(IN_OUT(x)));
	}
	static std::string test_func_raw_mem(size_t len,int* x) {
		return BOOST_PP_STRINGIZE(__BMOCK_EXPAND_ARG(RAW_MEM(IN_OUT,x,l)));
	}

	BOOST_AUTO_TEST_CASE(test_IN_OUT_Macro_ARG) {
		const in_out_raw_mem_descr<int> rm = in_out_raw_mem(val1,val2);
		const char expected[] = "bmock::make_in_out_arg_val(\"x\",x)";
		BOOST_CHECK_EQUAL(expected,test_func(rm));
	}

	BOOST_AUTO_TEST_CASE(test_RAW_MEM_IN_OUT_Macro_ARG) {
		const in_out_raw_mem_descr<int> rm = in_out_raw_mem(val1,val2);
		const char expected[] = "new bmock::in_out_raw_mem_ptr(\"x\",bmock::raw_mem(x,l))";
		BOOST_CHECK_EQUAL(expected,test_func_raw_mem(LEN1,rm));
	}
}
